package com.example.springboot1.dao;

import com.example.springboot1.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentDao {
    @Insert("insert into student(id,name,sex) values(#{id},#{stuname},#{sex})")
    int insert(Student student);
    @Select("select * from student where name=#{stuname}")
    List<Student> getByName(@Param("stuname") String name);
    @Results(id="userMap",value = {
            @Result(id = true,property = "stuname",column = "name")
    })
    @Select("select * from  student where id=#{id}")
    List<Student> getById(String id);
    @Select("select * from student")
    List<Student> getAll();
    @Delete("delete from student where id=#{id}")
    int delete(String id);
    @Update("update student set name=#{name},sex=#{sex} where id=#{id}")
    int update(Student student);
}
